<template>
  <div class="number-setter">
    <q-input-number
      v-model="_value"
      :max="max"
      :min="min"
      controls-position="right"
      @change="onChange"
    ></q-input-number>
    <span>{{ text }}</span>
  </div>
</template>


<script>
import { defineComponent, computed } from '@vue/composition-api';

export default defineComponent({
  name: 'NumberSetter',
  props: {
    value: {
      type: Number,
      default: 0,
    },
    text: {
      type: String,
      default: '',
    },
    max: {
      type: Number,
      default: 60,
    },
    min: {
      type: Number,
      default: 1,
    },
    onChange: {
      type: Function,
      default: () => {},
    },
  },
  setup(props) {
    return {
      _value: computed({
        get: () => props.value,
        set: (value) => props.onChange(value),
      }),
    };
  },
});
</script>
<style lang="scss" scoped>
.number-setter {
  display: flex;
  align-items: center;
  .q-input {
    width: 70px;
  }
  span {
    margin-left: 10px;
  }
}
</style>
